import request from "@/utils/request";

// 获取客户列表
export function getInorderListApi(query, data) {
  return request({
    url: "/system/inorder/list",
    method: "post",
    params: query,
    data,
  });
}

// 新增显示
export function showAddTemp(typeId) {
  return request({
    url: "/system/inorder/showAdd",
    method: "get",
    params: { typeId },
  });
}

export function saveAddWarehouseApply(data) {
  return request({
    url: "/system/inorder/saveAdd",
    method: "post",
    data: data,
  });
}

// 修改和查看明细显示
export function showEditTemp(params) {
  return request({
    url: `/system/inorder/getInfo`,
    method: "get",
    params,
    // params: { id },
  });
}

export function saveEditWarehouseApply(data) {
  return request({
    url: "/system/inorder/saveEdit",
    method: "post",
    data: data,
  });
}

// 获取物料列表（请购）
export function getInorderMaterialList(query, data) {
  return request({
    url: "/system/inorder/getInorderMaterialList",
    method: "post",
    params: query,
    data,
  });
}

// 出库审核
export function checkInorderApi(data) {
  return request({
    url: "/system/inorder/approval",
    method: "post",
    data,
  });
}

// 修改和查看明细显示
export function showAddDtl(id) {
  return request({
    url: "/system/inorder/showAddDtl",
    method: "get",
    params: { id },
  });
}

export function saveAddDtl(data) {
  return request({
    url: "/system/inorder/saveAddDtl",
    method: "post",
    data: data,
  });
}

export function saveAddDtlBatch(data) {
  return request({
    url: "/system/inorder/saveAddDtlBatch",
    method: "post",
    data: data,
  });
}

export function deleteOrder(id) {
  return request({
    url: "/system/inorder/delete",
    method: "get",
    params: { id },
  });
}

export function showModDtl(materialCode) {
  return request({
    url: `/system/inorder/showModDtl/?materialCode=${materialCode}`,
    method: "get",
    // params: { materialCode },
  });
}
// 撤销入库申请
export function saveCancel(id) {
  return request({
    url: "/system/inorder/cancel",
    method: "get",
    params: { id },
  });
}
// 到票信息
export function selectInvoceDetails(purchaseContractId) {
  return request({
    url: "/system/conInvoice/selectInvoceDetails",
    method: "get",
    params: { purchaseContractId },
  });
}
//入库申请关联单据数据
export function autoCompleteMaterialList(data) {
  return request({
    url: "/system/pub/autoCompleteMaterialList",
    method: "post",
    data: data,
  });
}
